using System;
using System.Collections.Generic;
using System.Text;

namespace csammisrun.shaim
{
  /// <summary>
  /// An assembly-level Attribute used to define the basic information of a shaim plugin
  /// </summary>
  [AttributeUsage(AttributeTargets.Assembly)]
  public class ShaimPluginDataAttribute : Attribute
  {
    private string _author = "";
    private string _name = "";
    private string _description = "";
    private Type _plugintype = null;
    private Type _configtype = null;

    /// <summary>
    /// Initializes a new ShaimPluginDataAttribute
    /// </summary>
    /// <param name="plugin">Sets the <see cref="Type"/> of the plugin object within the assembly</param>
    /// <param name="author">Sets the author of the plugin</param>
    /// <param name="name">Sets the name of the plugin</param>
    /// <param name="description">Sets a brief description of the plugin</param>
    public ShaimPluginDataAttribute(Type plugin, string author, string name, string description)
    {
      _author = author;
      _name = name;
      _description = description;
    }

    /// <summary>
    /// Gets the author of a shaim plugin
    /// </summary>
    public string Author
    {
      get { return _author; }
      set { _author = value; }
    }

    /// <summary>
    /// Gets the name of a shaim plugin
    /// </summary>
    public string Name
    {
      get { return _name; }
      set { _name = value; }
    }

    /// <summary>
    /// Gets the description of a shaim plugin
    /// </summary>
    public string Description
    {
      get { return _description; }
      set { _description = value; }
    }

    /// <summary>
    /// Gets the type of the plugin object within the assembly
    /// </summary>
    public Type PluginType
    {
      get { return _plugintype; }
      set { _plugintype = value; }
    }

    /// <summary>
    /// Gets the type of a plugin configuration object within the assembly, if one exists
    /// </summary>
    public Type ConfigType
    {
      get { return _configtype; }
      set { _configtype = value; }
    }
  }

  /// <summary>
  /// An assembly-level Attribute used to define specialized data for functionality plugins
  /// </summary>
  [AttributeUsage(AttributeTargets.Assembly)]
  public class ShaimFunctionalityPluginDataAttribute : Attribute
  {
    private bool _configurableoffline = false;
    private bool _showinlist = false;
    private bool _hascustomconfig = false;

    /// <summary>
    /// Initializes a new ShaimFunctionalityPluginDataAttribute
    /// </summary>
    /// <param name="configurableoffline">Sets a value indicating whether the plugin can be configured offline</param>
    /// <param name="showinlist">Sets a value indicating whether the plugin should be displayed in the configuration list</param>
    /// <param name="customconfig">Sets a value indicating whether the plugin has a custom configuration screen</param>
    public ShaimFunctionalityPluginDataAttribute(bool configurableoffline, bool showinlist, bool customconfig)
    {
      _configurableoffline = configurableoffline;
      _showinlist = showinlist;
      _hascustomconfig = customconfig;
    }

    /// <summary>
    /// Gets a value indicating whether the plugin has a custom configuration screen
    /// </summary>
    public bool HasCustomConfig
    {
      get { return _hascustomconfig; }
      set { _hascustomconfig = value; }
    }

    /// <summary>
    /// Gets a value indicating whether the plugin can be configured offline
    /// </summary>
    public bool ConfigurableOffline
    {
      get { return _configurableoffline; }
      set { _configurableoffline = value; }
    }

    /// <summary>
    /// Gets a value indicating whether the plugin should be displayed in the configuration list
    /// </summary>
    public bool ShowInList
    {
      get { return _showinlist; }
      set { _showinlist = value; }
    }
  }

  /// <summary>
  /// An assembly-level Attribute used to define specialized data for protocol plugins
  /// </summary>
  [AttributeUsage(AttributeTargets.Assembly)]
  public class ShaimProtocolPluginDataAttribute : Attribute
  {
    private string _displayname = "";
    private string _iconpath = "";

    /// <summary>
    /// Initializes a new ShaimProtocolPluginDataAttribute
    /// </summary>
    /// <param name="displayname">Sets the displayable name of the protocol network</param>
    /// <param name="iconpath">Sets the path to the icon from within the plugin assembly</param>
    public ShaimProtocolPluginDataAttribute(string displayname, string iconpath)
    {
      _displayname = displayname;
      _iconpath = iconpath;
    }

    /// <summary>
    /// Gets the displayable name of the protocol network
    /// </summary>
    public string DisplayName
    {
      get { return _displayname; }
      set { _displayname = value; }
    }

    /// <summary>
    /// Gets the path to the icon from within the plugin assembly
    /// </summary>
    public string IconPath
    {
      get { return _iconpath; }
      set { _iconpath = value; }
    }
  }

  /// <summary>
  /// An assembly-level Attribute used to tag a UI plugin
  /// </summary>
  [AttributeUsage(AttributeTargets.Assembly)]
  public class ShaimUIPluginDataAttribute : Attribute
  {
    /// <summary>
    /// Mark an assembly as a shaim UI plugin
    /// </summary>
    public ShaimUIPluginDataAttribute()
    {
    }
  }

  /// <summary>
  /// An attribute used to locate a plugin configuration object within an assembly
  /// </summary>
  [AttributeUsage(AttributeTargets.Assembly)]
  public class ShaimPluginConfigObjectAttribute : Attribute
  {
    private Type _configobject = null;

    /// <summary>
    /// Initializes a new ShaimPluginConfigObjectAttribute
    /// </summary>
    /// <param name="configobject">Sets the <see cref="Type"/> of the custom configuration object</param>
    public ShaimPluginConfigObjectAttribute(Type configobject)
    {
      _configobject = configobject;
    }

    /// <summary>
    /// Gets the type of the custom configuration object
    /// </summary>
    public Type ConfigObject
    {
      get { return _configobject; }
      set { _configobject = value; }
    }
  }
}
